<?php
if (! defined ( FLAG )){ trigger_error('Access error!', E_USER_ERROR); die; }

global $STR;
$STR->setVar(array('DATA','title'),'Driver-cmf | Крестики-нолики');
$STR->setVar(array('DATA','main_text'),'');

	$BD = $STR->getVar(array('BD'));

echo '1 страница';
/*
var_dump($_POST);

$flag['entery'] = 0;
$flag['select'] = 0;

if ($flag['entery'] == 0) {
	if (isset($_POST['enteryForm'])) {
		$post = $_POST['enteryForm'];
		$res = $BD->Query('SELECT DISTINCT * FROM `krestikii-noliki`.`gamers` WHERE login = \''.$post['login'].'\' AND password = \''.md5($post['password']).'\'')->Fetch();
		if ($res != false) {
			$_SESSION['id_gamers'] = $res['id'];
			$id_gamers = $res['id'];
			$flag['entery'] = 1;
		} else {
			$error[] = 'Неверный логин или пароль';
		}
	}	
}

if($flag['entery'] == 1){
	$Query=$BD->Query('SELECT * FROM `krestikii-noliki`.`games` WHERE openly = \'1\'');
	
	while($res = $Query->Fetch()) {
		$list_games[]=$res;
	}
}

if ($flag['entery'] == 1){
	if (isset($_POST['addForm'])) {
		$post = $_POST['addForm'];
		$res = $BD->Query('INSERT INTO  `krestikii-noliki`.`games` (
						`id` ,
						`gamers` ,
						`openly` ,
						`game_map` ,
						`time`
						)VALUES (NULL ,  \''.$id_gamers.'\',  \'1\',  \'{}\', NOW( ));');
	var_dump('expression');
	}	
}

$STR->setVar(array('DATA','flag'),$flag);

if(isset($id_gamers)){
	$STR->setVar(array('DATA','id_gamers'),$id_gamers);	
}
if(isset($error)){
	$STR->setVar(array('DATA','error'),$error);
}

if(isset($list_games)){
	$STR->setVar(array('DATA','list_games'),$list_games);
}
*/
?>
